package test2;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(9999);
        Socket socket = ss.accept();
        InputStreamReader isr = new  InputStreamReader(socket.getInputStream());
        int b;
        while ((b = isr.read()) != -1) {
            System.out.print((char)b);
        }
        OutputStreamWriter osw = new OutputStreamWriter(socket.getOutputStream());
        String str = "你也好!";
        osw.write(str);
        osw.close();
        isr.close();
        socket.close();
        ss.close();
    }
}
